1 //-------------------------------------------------------------------------------------------------
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // Misc templates that make exception guarantees.
7 //-------------------------------------------------------------------------------------------------
12 GuardBase() : m_enabled(true), m_hasRun(false)
16 virtual void DoAction() = 0;
22 if ( m_enabled
&& !m_hasRun
)
29 bool IsEnabled() const
34 void SetIsEnabled(bool enabled
)
41 GuardBase(const GuardBase
&);
42 GuardBase
& operator=(const GuardBase
&);
49 class ClearPointerGuard
: public GuardBase
52 ClearPointerGuard(T
*& ptr
) : m_ptr(ptr
)